package com.yjd.bi.authority.service.impl;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;

import com.yjd.comm.base.dao.IBaseDao;
import com.yjd.comm.base.service.impl.BaseServiceImpl;
import com.yjd.bi.authority.model.AuthorityManagementModel;
import com.yjd.bi.authority.service.IAuthorityManagementService;
import com.yjd.bi.authority.dao.IAuthorityManagementDao;

/**
 * <b>description</b>：权限管理业务实现<br>
 * <b>time</b>：2018-01-09 14:51:27 <br>
 * <b>author</b>：  yangchangyan@yijiedai.com
 */
@Service("authorityManagementService")
public class AuthorityManagementServiceImpl extends BaseServiceImpl implements IAuthorityManagementService {

	/**
	 * 插入
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public AuthorityManagementModel insert(AuthorityManagementModel model) throws Exception {
		return this.authorityManagementDao.insertModel(model, true);
	}

	/**
	 * 更新
	 * 
	 * @param model
	 * @return
	 * @throws Exception
	 */
	public int update(AuthorityManagementModel model) throws Exception {
		return this.authorityManagementDao.updateModel(model, true);
	}

	/**
	 * 根据id删除
	 * 
	 * @param admin_id
	 * @return
	 * @throws Exception
	 */
	public int delete(long admin_id) throws Exception {
		Map<Object, Object> paramMap = new HashMap<Object, Object>();
		paramMap.put("admin_id", admin_id);
		return this.authorityManagementDao.deleteModel(paramMap, true);
	}

	@Resource
	private IAuthorityManagementDao authorityManagementDao;

	@Override
	public IBaseDao getBaseDao() {
		return this.authorityManagementDao;
	}

}
